<?php

class default_Form_Contacto extends Zend_Form {

    public function init() {

        $this->setMethod('post');

        $asunto = $this->createElement('text', 'asunto');
        $asunto->addFilters(array('StringTrim', 'StripTags'))
                ->setRequired(true)
                ->setAttrib('class', 'lf')
                ->setLabel('Asunto : ');

        $nombre = $this->createElement('text', 'nombre');
        $nombre->addFilters(array('StringTrim', 'StripTags'))
                ->addValidators(array(array('Alnum', false, array('allowWhiteSpace' => true)), array('StringLength', false, array(3, 100))))
                ->setRequired(true)
                ->setAttrib('class', 'lf')
                ->setLabel('Nombre : ');

        $email = $this->createElement('text', 'email');
        $email->addFilters(array('StringTrim', 'StringToLower'))
                ->addValidator('EmailAddress', true)
                ->setRequired(true)
                ->setAttrib('class', 'lf')
                ->setLabel('Email :');

        $empresa = $this->createElement('text', 'empresa');
        $empresa->addFilters(array('StringTrim', 'StripTags'))
                ->setRequired(true)
                ->setAttrib('class', 'lf')
                ->setLabel('Empresa : ');

        $pais = $this->createElement('text', 'pais');
        $pais->addFilters(array('StringTrim', 'StripTags'))
                ->addValidators(array(array('Alnum', false, array('allowWhiteSpace' => true)), array('StringLength', false, array(3, 100))))
                ->setRequired(true)
                ->setAttrib('class', 'lf')
                ->setLabel('Pais : ');

        $telefono = $this->createElement('text', 'telefono');
        $telefono->addFilters(array('StringTrim', 'StripTags'))
                ->addValidator('Digits', true)
                ->setRequired(true)
                ->setAttrib('class', 'lf')
                ->setLabel('Teléfono (solo numeros) : ');

        $mensaje = $this->createElement('textarea', 'mensaje');
        $mensaje->addFilters(array('StringTrim', 'StripTags'))
                ->setRequired(true)
                ->setAttrib('class', 'lf')
                ->setLabel('Mensaje : ');

        $captcha = $this->createElement('captcha', 'captcha',
                        array('required' => true,
                            'captcha' => array(
                                'captcha' => 'Image',
                                'font' => 'css/TravelingTypewriter.ttf',
                                'fontSize' => '24',
                                'wordLen' => 5,
                                'height' => '50',
                                'width' => '150',
                                'imgDir' => APPLICATION_PATH . '/../public/uploads/captcha',
                                'imgUrl' => '/uploads/captcha',
                                'dotNoiseLevel' => 40,
                                'lineNoiseLevel' => 1
                            )
                        )
        );

        $captcha->setLabel('Ingresa los 5 caracteres que aparecen : ')
                ->setAttrib('class', 'captcha-sf');

        $enviar = $this->createElement('submit', 'enviar');
        $enviar->setRequired(false)
                ->setIgnore(true)
                ->setLabel('Enviar')
                ->setAttrib('class', 'button')
                ->removeDecorator('DtDdWrapper');

        $this->addElements(array($asunto, $nombre, $email, $empresa, $pais, $telefono, $mensaje, $captcha, $enviar));
    }

}